#include <iostream>
#include <cstdlib>

using namespace std;

class DayOfYear
{
    public:
        DayOfYear(int monthValue, int dayValue);
        DayOfYear(int monthValue);
        DayOfYear();

        // void input();
        void output();
        // int getMonthNumber();
        // int getDay();
    private:
        int month;
        int day;
        void testDate();
};

class Holiday
{
    public:
        Holiday();
        Holiday(int month, int day, bool theEnforcement);
        void output();
    private:
        DayOfYear date;
        bool parkingEnforcement;
};

int main()
{
    // Holiday h(2, 14, true);
    Holiday h;
    cout << "Testing the class Holiday.\n";
    h.output();
    return 0;
}

void DayOfYear::output()
{
    cout << "Month-" << month << "  Day-" << day;
}

DayOfYear::DayOfYear(int monthValue, int dayValue) : month(monthValue), day(dayValue)
{
    testDate();
}

DayOfYear::DayOfYear(int monthValue) : month(monthValue), day(1)
{
    testDate();
}

DayOfYear::DayOfYear() : month(1), day(1)
{}

void DayOfYear::testDate()
{
    if ((month < 1) || (month > 12))
    {
        cout << "Illegal month value !\n";
        exit(1);
    }
    if ((day < 1) || (day > 31))
    {
        cout << "Illegal day value !\n";
        exit(1);
    }
}

Holiday::Holiday() : date(1, 1), parkingEnforcement(false)
{}

Holiday::Holiday(int month, int day, bool theEnforcement)
                    :date(month, day), parkingEnforcement(theEnforcement)
{}

void Holiday::output()
{
    date.output();
    cout << endl;

    if (parkingEnforcement)
        cout << "Parking laws will be enforced.\n";
    else
        cout << "Parking laws will not be enforced.\n";
}

